﻿//***********************************************************************
// Assembly         : IGolovkine.AoA.Tcp.Hosting.Console
// Author           : Ilia
// Created          : 06-11-2011
//
// Last Modified By : Ilia
// Last Modified On : 01-10-2010
// Description      : 
//
// Copyright        : (c) Microsoft. All rights reserved.
//***********************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IGolovkine.AoA.Tcp;
using System.Windows.Markup;
using System.IO;
using IGolovkine.AoA.Tcp.Channels.Http;
using System.Threading;
using System.Net;

namespace IGolovkine.AoA.Hosting.Console
{
    internal static class Program
    {
        static void Main(string[] args)
        {
            IMessageChannel channel;
            if (args.Length == 0)
            {
                channel = new HttpChannelClient(
                    new HttpChannelClientConfiguration()
                    {
                        ServerUrl = "http://phenom/HttpTunnel/"//,
                        //Proxy = new WebProxy("http://phenom:8080/", false)
                    });
            }
            else
            {
                HttpChannelServerConfiguration config = new HttpChannelServerConfiguration(args);
                channel = new HttpChannelServer(config);
            }
            TcpTunnel tunnel = new TcpTunnel(channel);
            if (channel is HttpChannelClient)
            {
                tunnel.Routes.OnNext(new TcpTunnelRoute(TcpTunnelDirection.Outbound, 5555, "phenom", 3389));
                tunnel.Routes.OnNext(new TcpTunnelRoute(TcpTunnelDirection.Outbound, 8080, "phenom", 8080));
            }
            System.Console.ReadLine();

           
        }
    }
}
